<!-- 个人中心 -->
<template>
  <view class="container">
    <view class="title">
      {{detailData.title}}
    </view>
    <view class="zhong">
      <view class="wz">文章来源：原创
      </view>
      <view class="time">{{detailData.createtime | formatTime}}
      </view>
    </view>
    <view class="img">
      <!--            <image style="width: 690rpx;height: 300rpx;" src="../../static/image/zb19.png"></image> -->
    </view>
    <!-- <view class="content" v-html="detailData.info">
		
    </view> -->
	<view style="margin:20rpx 0;" >
			<u-parse :html="detailData.info" :tag-style="vuex_parse_style" :domain="'https://huboshizb.bigchun.com'"
			 @linkpress="diylinkpress"></u-parse>
	</view>
    <!-- <view class="content" v-html="detailData"></view> -->
  </view>
</template>

<script>
export default {
  data() {
    return {
      detailData: {}
    };

  },
  filters: {
    formatTime(val) {
      const date = new Date(val * 1000)
      var y = date.getFullYear() // 年份
      var m = date.getMonth() + 1 // 月份，注意：js里的月要加1
      var d = date.getDate() // 日
      // 返回值，根据自己需求调整，现在已经拿到了年月日时分秒了 
      return y + '-' + m + '-' + d
    }
  },
  onLoad(option) {
    this.getData(option.id)
  },
  onShow() {

  },
  onReachBottom() {

  },
  computed: {

  },
  onPullDownRefresh() { },
  methods: {
    getData(id) {
		
		this.$api.infodetail( {
          article_id: Number(id),
        }).then(res => {
			// res.data.info = res.data.info.replace(/https:\/\/[^\/]*(\/)*/g, '/')
			// res.data.info = res.data.info.replace(/<img [^>]*src=['"]/g,  '<img src="https://huboshizb.bigchun.com')
			console.log(res.data.info);
			
			this.detailData = res.data
			
		})
		
		return
		
      let that = this
      uni.request({
        url: 'https://huboshizb.bigchun.com/api/info/detail', //仅为示例，并非真实接口地址。
        method: 'POST',
        data: {
          article_id: Number(id),
        },
        success: (res) => {

          that.detailData = res.data.data
          console.log('详情res', res, that.detailData)
        }
      });
    },
  }
}
</script>

<style lang="scss" scoped>
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
.container {
  padding: 30rpx;
}
.title {
  font-size: 32rpx;
  font-family: Source Han Sans CN-Bold, Source Han Sans CN;
  font-weight: bold;
  color: #333333;
}
.zhong {
  display: flex;
  font-size: 28rpx;
  font-family: Source Han Sans CN-Regular, Source Han Sans CN;
  font-weight: 400;
  color: #cccccc;
  margin-top: 26rpx;
  justify-content: space-between;
}

.content {
  font-size: 28rpx;
  font-family: Source Han Sans CN-Regular, Source Han Sans CN;
  font-weight: 400;
  color: #333333;
  margin-top: 30rpx;
}
.img {
  margin-top: 30rpx;
}
</style>
